package com.zzyl;

import cn.hutool.http.HttpResponse;
import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSONUtil;
import org.junit.jupiter.api.Test;

import java.util.HashMap;

public class testResponse {
    @Test
    public void testPost(){
        String url ="http://192.168.15.179:8080/serve/project";
        HashMap<String, Object> paramMap = new HashMap<>();
        paramMap.put("name", "zhoutunfa");
        paramMap.put("orderNo", 1);
        paramMap.put("unit", "次");
        paramMap.put("price", 10.00);
        paramMap.put("image","https://p1.ssl.qhmsg.com/t01f60859fc4c173d87.png");
        paramMap.put("nursingRequirement", "无特殊要求");
        paramMap.put("status", 1);

 /*       String result = HttpUtil.post(url, JSONUtil.toJsonStr(paramMap));
        System.out.println(result);*/



        HttpResponse execute = HttpUtil.createPost(url)
                .header("authorization", "Bearer eyJhbGciOiJIUzUxMiJ9.eyJsb2dpbl91c2VyX2tleSI6ImMwYzBkMmI5LWRmOWMtNGU0NS1hNTZlLTI1ODU3NjgyNTE5MSJ9.fx-3lOwI8VWUHF3eugZR-b47zcILb17PPtx3Uq8A9tFwbGej_zm8qa1q_DzFkrDfhwq0vBt0evOqNOHU4aSqmg")
                .body(JSONUtil.toJsonStr(paramMap))
                .execute();


        System.out.println(execute);
    }
}
